﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using TamerlaneData;
using System.Drawing;

namespace Tamerlane
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = e.Source as MenuItem;

            switch (mi.Name)
            {
                case "loadmap":

                    try
                    {

                        List<Province> provincedata = FileParser.LoadMapText("mapdata.txt");
                        Bitmap mapimage = FileParser.LoadMapImage("map.bmp");

                        //Show image
                        mapImage.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(mapimage.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty,
                System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
                    }

                    catch (Exception e1)
                    {
                        MessageBox.Show("Could not load map \n " + e1.ToString());
                    }

                    break;
            }
        }
    }
}
